﻿using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using GomeeSoft.src.classes;
using GomeeSoft.src.form;

namespace GomeeSoft
{
    static class Program
    {
        /// <summary>
        /// 해당 응용 프로그램의 주 진입점입니다.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Global.designMode = false;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
            //SetPassword(Global.DBPassword);
            //UnSetPassword(Global.DBPassword);
        }

        static private void SetPassword(string password)
        {
            string connectionSting = "Data Source=" + Global.GetDatabaseDirectory() + ";";
            SQLiteConnection conn = new SQLiteConnection(connectionSting);
            conn.Open();
            conn.ChangePassword(password);
            conn.Close();
        }

        static private void UnSetPassword(string password)
        {
            string connectionSting = "Data Source=" + Global.GetDatabaseDirectory() + ";Password=" + Global.DBPassword + ";";
            SQLiteConnection conn = new SQLiteConnection(connectionSting);
            conn.Open();
            conn.ChangePassword((String)null);
            conn.Close();
        }
    }
}
